#include <stdio.h>
#include <stdlib.h>

int main (int argc, char const* argv[])
{
    int idx, t, a[100], i, j, cnt;

    idx = 0;
    while (EOF != scanf("%d", &t)) {
        if (t == -1) {
            break;
        } else if (t == 0) {
            cnt = 0;
            for (i = 0; i < idx; i++) {
                if (a[i] % 2 != 0) continue;

                for (j = 0; j < idx; j++) {
                    if (a[i] / 2 == a[j]) {
                        cnt++;
                    }
                }
            }
            printf("%d\n", cnt);
            idx = 0;
        } else {
            a[idx++] = t;
        }
    }

    return 0;
}
